package com.ganmiao.server.supplier.mapper;

import com.ganmiao.server.supplier.entity.SupplierTenderProduct;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SupplierTenderProductMapper {

    @Select("<script>" +
            "select * from products " +
            "<if test='id != null' >" +
            "where id = #{id}" +
            "</if>" +
            "</script>")
    public SupplierTenderProduct supplierTenderProductGet(Integer id);

    @Insert("insert into products(id,tenders_product_id,tenders_id, supplier_id, product_id, bidding_price, status, deposit_status)" +
            "values(#{id},#{tenders_product_id},#{tenders_id}, #{supplier_id}, #{product_id}, #{bidding_price}, #{status}, #{deposit_status})")
    public Integer supplierTenderProductInsert(SupplierTenderProduct supplierTenderProduct);

    @Delete("DELETE FROM products WHERE id = #{id}")
    public void supplerTenderProductDelete(Integer id);

    @Update("UPDATE products SET tenders_product_id = #{tenders_product_id}, tenders_id = #{tenders_id}, supplier_id = #{supplier_id}, product_id = #{product_id}, " +
            "WHERE id = #{id}")
    public void supplierTenderProductUpdate(Integer id, Integer tenders_product_id, Integer tenders_id, Integer supplier_id, Integer product_id, Integer bidding_price, Integer status, Integer deposit_status);
}
